import React from 'react';
import { connect } from 'dva';
import BasePage from './BasePage'
import { Card, Space, Form, Radio, Upload, Input, Button, Alert, Result, Select } from 'antd'
import { UploadOutlined } from '@ant-design/icons';
import style from '../assets/less/certificationLess.less'
import CurrentLocation from '../components/currentLocation'
import constant from '../constant/constant'
import breadArr from '../constant/breadArr'
import UserTable from '../components/table/userTable'

class UserManagementPage extends React.Component {
    constructor(props) {
        super(props)
    }

    renderUserManagementPage = user => {
        if (user == {} || user.userName != "admin") {
            return (
                <Result
                    status="warning"
                    title="请先登录超级管理官账号！"
                >
                </Result>
            )
        }

        if(user.userName == "admin"){
            return(
                <div style={{marginTop:30,width:850}}><UserTable></UserTable></div>
            )
        }
    }

    render() {
        return (
            <BasePage>
                <CurrentLocation breadArr={breadArr.UserManagementPage}></CurrentLocation>
                {this.renderUserManagementPage(this.props.user)}
            </BasePage>
        )
    }
}

const mapStateToProps = state => {
    let user = state.app.user
    return {
        user
    }
}

export default connect(mapStateToProps)(UserManagementPage)